package com.example.demo.controller;

import com.example.demo.dao.ChukuTypeDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
public class ChukuTypeController {
    @Autowired
    ChukuTypeDao chukutypeDao;

    @PostMapping("/count_all_chukutype")
    public long count_all_chukutype(@RequestBody Map map){
        return chukutypeDao.count_all_chukutype(map);
    }
    @PostMapping("/add_chukutype")
    public int add_chukutype(@RequestBody Map map){
        return chukutypeDao.add_chukutype(map);
    }

    @PostMapping("/find_all_chukutype")
    public List<Map> find_all_chukutype(@RequestBody Map map) throws InterruptedException {
        Thread.sleep(1000);
        return chukutypeDao.find_all_chukutype(map);
    }
    @PostMapping("/upd_chukutype")
    public int upd_chukutype(@RequestBody Map map){
        return chukutypeDao.upd_chukutype(map);
    }

    @PostMapping("/upd_chukutype2")
    public int upd_chukutype2(@RequestBody Map map){
        return chukutypeDao.upd_chukutype2(map);
    }
}